{% extends 'base.html' %}
{% block title %}待办事项程序{% endblock %}

<!--导航-->
{% block content %}
  <div id="navigation" class="container-fluid">
    <nav class="navbar navbar-default nav-inverse">
      <div class="navbar-header">
        <a class="navbar-brand" href="#"><span class="glyphicon glyphicon-th-list">TODO</span></a>
      </div>
    </nav>
  </div>


{#  添加todo表单#}
<div id="todo-add" class="container">
  <form action="{{ url_for('add') }}" method="post" class="form-inline float-right">
    <textarea rows=5 cols=50 placeholder="请输入待办事项" name="content"></textarea>
    <button type="submit" class="btn btn-success btn-lg" style="height:120px;">添加</button>
  </form>
</div>



<div id="todo-list">
  <table class="table table-striped">
    <th>
      <td>创建时间</td>
      <td>状态</td>
      <td>内容</td>
      <td>删除</td>
      <td>完成</td>
    </th>
    {% for todo in todo_list %}
      <tr>
        <td>{{ loop.index }}</td>
        <td>{{todo.create_time  }}</td>
        {% if todo.status == 0 %}
          <td><span class="glyphicon glyphicon-asterisk btn-warning"></span></td>
        {% elif todo.status == 1 %}
          <td><span class="glyphicon glyphicon-asterisk btn-success"></span></td>
        {% endif %}
        <td>{{ todo.content }}</td>
        <td><a href="{{ url_for('delete',_id=todo._id) }}"><span class="glyphicon glyphicon-remove"></span></a></td>
        <td><a href="{{ url_for('finish', _id=todo._id) }}"><span class="glyphicon glyphicon-ok"></span></a></td>
{#        {{ todo_id }}#}
      </tr>
    {% endfor %}
  </table>
</div>
{% endblock %}

